<style>
<!--
#referenceTableColumns table td{
	height: 30px;
}
-->
</style>
<div class="row">
	<div class="col-lg-12 col-sm-12 col-xs-12">
        <div class="widget  flat radius-bordered"  style="margin-bottom: 0px;">
            <div class="widget-header bg-sky theme">
                <span class="widget-caption">生成代码</span>
            </div>
            <div class="widget-body no-padding-bottom no-padding-top">
                <div class="row pricing-container no-padding-bottom no-padding-top">
	                <form class="form-horizontal no-padding-bottom no-margin-bottom"
		                    role="form" 
		                    responseType="JSON" 
		                    method="post" id="genCode" 
		                    action="codeGenerateController/generateCode.do"
		                    data-bv-message="This value is not valid"
							data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
							data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
							data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">
                        <div class="form-title">Now selected table</div>
	                	<div class="col-xs-12">
	                		<div class="plan">
		                		<#list defaultConfigs?keys as key>
			                    	<input type="hidden" name="${key}_attrJsonConfig">
		                    	</#list>
	                    		<div class="header bordered-azure theme-bordered" title="${tableName}" style="margin-bottom:20px;">
					            	${tableName}
					            </div>
		                        <div class="row">
		                        	<div class="col-sm-6">
				                        <div class="form-group">
				                            <label for="inputEmail3" class="col-sm-2 control-label no-padding-right">catalog</label>
				                            <div class="col-sm-10">
				                            	<span class="input-icon icon-right">
					                                <input type="text" class="form-control" name="catalog" id="catalog" placeholder="catalog" readonly="readonly" value="${catalog}">
					                                <i class="fa fa-list"></i>
				                            	</span>
				                            </div>
				                        </div>
		                        	</div>
		                        	<div class="col-sm-6">
				                        <div class="form-group">
				                            <label for="inputEmail3" class="col-sm-2 control-label no-padding-right">表名</label>
				                            <div class="col-sm-10">
					                            <span class="input-icon icon-right">
					                                <input type="text" class="form-control" name="tableName" id="tableName" placeholder="表名" readonly="readonly" value="${tableName}">
					                                <i class="fa fa-table"></i>
				                                </span>
				                            </div>
				                        </div>
		                        	</div>
		                        </div>
		                        <div class="row">
		                        	<div class="col-sm-6">
				                        <div class="form-group">
				                            <label  class="col-sm-2 control-label no-padding-right">实体类名</label>
				                            <div class="col-sm-10">
					                            <span class="input-icon icon-right">
				                                	<input type="text" class="form-control" name="entityName" id="entityName" placeholder="实体类名" readonly="readonly" value="${entityName}">
			                                	 	<i class="fa fa-code"></i>
				                                </span>
				                            </div>
				                        </div>
		                        	</div>
		                        	<div class="col-sm-6">
				                        <div class="form-group">
				                            <label  class="col-sm-2 control-label no-padding-right">业务描述</label>
				                            <div class="col-sm-10">
				                             	<span class="input-icon icon-right">
					                                <input type="text" class="form-control" name="${tableName}_businessDescription" id="businessDescription" placeholder="业务描述" value="${businessDescription}"
					                                data-bv-notempty="true" data-bv-notempty-message="The field is required and cannot be empty" >
					                                <i class="fa fa-info-circle"></i>
				                                </span>
				                            </div>
				                        </div>
		                        	</div>
				                	<div class="col-sm-6">
				                	 	<div class="form-group">
				                            <label  class="col-sm-2 control-label no-padding-right">逻辑删除</label>
				                            <div class="col-sm-10">
				                             	<div class="col-sm-2">
							                       	<input type="hidden" name="${tableName}_isLogicDelete" >
								                   	<label>
								                       <input class="checkbox-slider slider-icon yesno" type="checkbox" onchange="(function(that){var deleteIdentifyingField=$('#${tableName}_deleteIdentifyingField');that.checked ? deleteIdentifyingField.show():deleteIdentifyingField.hide()})(this)"  data-target-input-name="${tableName}_isLogicDelete">
								                       <span class="text"></span>
								                   	</label>
												</div>
												<div class="col-sm-8 no-padding-right" id="${tableName}_deleteIdentifyingField" style="display:none; float: right;">
													<#--删除标识属性-->
													<label  class="col-sm-3 control-label no-padding-right">删除标识列</label>
													<div class="col-sm-9 no-padding-right">
														<input type="text"  class="form-control"  name="${tableName}_deleteIdentifyingField" >
						                            </div>
					                            </div>
				                            </div>
				                        </div>
				                	</div>
		                        	<div class="col-sm-12">
				                        <div class="form-group">
				                            <label  class="col-sm-1 control-label no-padding-right">生成文件</label>
		                             		<div class="col-lg-11 col-sm-11 col-xs-11" style="text-align: left;">
												<#list templates?split(",") as template>
					                                <div class="checkbox" style="width: 130px; float:left;">
				                                    	<input type="hidden" name='${tableName}_${template?split("->")[1]?replace(".","-")}' value="true">
					                                    <label class="no-padding-left">
					                                        <input type="checkbox" class="Basic" data-target-input-name='${tableName}_${template?split("->")[1]?replace(".","-")}' value="1" checked="checked">
					                                        <span class="text">${template?split("->")[0]}</span>
					                                    </label>
					                                </div>
					                            </#list>
				                            </div>
				                        </div>
		                        	</div>
		                        </div>
		                         <div class="row">
		                        	<div class="col-sm-12">
				                        <div class="form-group">
				                            <div class="col-sm-offset-1 col-sm-10">
				                                <button type="submit" class="btn btn-danger">生成参数</button>
				                            </div>
				                        </div>
		                        	</div>
		                        </div>
	                        </div>
	                	</div>
                        <#if refTables?size gt 0>
	                        <div class="form-title">Foreign key associated reference table</div>
	                        <div class="row pricing-container no-padding-bottom no-padding-top referenceTables">
	                           	<#list refTables as rt>
	                           		<div class="col-xs-12 col-sm-6 col-md-4 referenceTable" >
							        	<div class="plan" style="padding-bottom: 20px">
								            <div class="header bordered-azure theme-bordered" title="${rt.referenceTableName}"style="font-size: 14px">
								            	<#if rt.referenceTableName==tableName>
								            		<span class="glyphicon glyphicon-retweet" style="color: red; float: left;"></span>
								            	<#else>
								            		<span class="glyphicon glyphicon-random" style="color: green; float: left;"></span>
								            	</#if>
								            	<span style="width:95%;overflow:hidden;display:block;padding-left:8px;">${rt.referenceTableName}</span>
								            </div>
								            <div class="price azure" title="${rt.foreignKeyName}" style="font-size: 12px">
								            	${rt.foreignKeyName}
								            </div>
								            <ul>
								                <li><b>引用列：</b> ${rt.foreignKeyColumnName}</li>
								                <li class="nopadding"style="font-size:50px; color:#a0d468!important;">
								                	<i class="fa fa-sitemap"></i>
								                </li>
								                <li style="min-height: 53px"><b>外键列：</b> ${rt.referenceColumnName}</li>
								                <li>
								                	<div class="col-lg-12 col-sm-12 col-xs-12 genFile_checkAll" style="text-align: left;">
														<b>
															生成文件：
															<label class="nomargin-bottom" style="cursor:pointer;">
																<input class="checkbox-slider yesno" type="checkbox" checked="checked">
																<span class="text">&nbsp;&nbsp;全选/全不选</span>
															</label>
															<#if rt.referenceTableName==tableName><span style="color: red">自关联表以当前选择表的设置为准</span></#if>
														</b>
													</div>
													<#list templates?split(",") as template>
								                	 	<div class="col-lg-6 col-sm-6 col-xs-6" style="text-align: left;">
							                                <div class="checkbox">
							                                	<#if rt.referenceTableName==tableName>
							                                		<#--自关联-->
								                                    <label>
								                                        <input type="checkbox" class="Basic" disabled="disabled" data-target-input-name='${template?split("->")[1]?replace(".","-")}' value="1" checked="checked">
								                                        <span class="text" title='${template?split("->")[0]}'>
								                                        	${template?split("->")[0]}
								                                        </span>
								                                    </label>
							                                	<#else>
							                                		<#--非自关联-->
							                                    	<input type="hidden" name='${rt.referenceTableName}_${template?split("->")[1]?replace(".","-")}' value="true">
								                                    <label>
								                                        <input type="checkbox" class="Basic" data-target-input-name='${rt.referenceTableName}_${template?split("->")[1]?replace(".","-")}' value="1" checked="checked">
								                                        <span class="text" title='${template?split("->")[0]}'>
								                                        	${template?split("->")[0]}
								                                        </span>
								                                    </label>
							                                	</#if>
							                                </div>
					                                	</div>
						                            </#list>
								                </li>
								                <#if rt.referenceTableName!=tableName>
									                <li>
									                	<div class="col-lg-12 col-sm-12 col-xs-12 form-group" style="text-align: left; padding-left: 15px;width: 103%;">
									                		<div class="form-title"></div>
									                		<div class="col-lg-2 col-sm-3 col-xs-3" style="line-height: 36px;">
										                		<b>业务描述：</b>
									                		</div>
									                			<div class="col-lg-9 col-sm-9 col-xs-9">
									                			<span class="input-icon icon-right">
									                                <input type="text" class="form-control" name="${rt.referenceTableName}_businessDescription" id="businessDescription" placeholder="业务描述" value="${rt.referenceTableRemarks}"
									                                data-bv-notempty="true" data-bv-notempty-message="请填写该关联表的业务描述" >
									                                <i class="fa fa-info-circle"></i>
								                                </span>
									                		</div>
									                	</div>
									                </li>
								                </#if>
								                <li>
								                	<div class="col-lg-12 col-sm-12 col-xs-12 form-group" style="text-align: left; padding-left: 15px;width: 103%;">
								                		<div class="form-title"></div>
								                		<div class="col-lg-3 col-sm-3 col-xs-3" style="line-height: 36px;">
									                		<b>逻辑删除：</b>
								                		</div>
								                			<div class="col-lg-9 col-sm-9 col-xs-9"style="float: right;">
								                			<div class="col-sm-2">
										                       	<input type="hidden" name="${rt.referenceTableName}_isLogicDelete" >
											                   	<label>
											                       <input class="checkbox-slider slider-icon yesno" type="checkbox" onchange="(function(that){var deleteIdentifyingField=$('#${rt.referenceTableName}_deleteIdentifyingField');that.checked ? deleteIdentifyingField.show():deleteIdentifyingField.hide()})(this)"  data-target-input-name="${rt.referenceTableName}_isLogicDelete">
											                       <span class="text"></span>
											                   	</label>
															</div>
															<#--删除标识属性-->
															<input type="text" name="${rt.referenceTableName}_deleteIdentifyingField" id="${rt.referenceTableName}_deleteIdentifyingField" style="display:none;">
								                		</div>
								                	</div>
								                </li>
								            </ul>
								        </div>
								    </div>
	                           	</#list>
	                        </div>
                        </#if>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="row">
	<div class="col-lg-12 col-sm-12 col-xs-12">
        <div class="widget  collapsed" style="margin-top:0px;">
            <div class="widget-header">
                <i class="widget-icon fa fa-arrows-v blue"></i>
                <span class="widget-caption">当前参数配置</span>
                <div class="widget-buttons">
                    <a href="#" data-toggle=maximize>
                    </a>
                    <a href="#" data-toggle="collapse">
                        <i class="fa fa-plus blue"></i>
                    </a>
                </div>
            </div>
	        <div class="widget-body"  id="config">
	        	<!-- js加载内容 -->
			</div>
         </div>
	</div>
</div>
<div class="row" id="nowSetTable">
	<!-- 映射列表 -->
	<#if !exception??>
		<div class="col-xs-8 nopadding-right" id="leftTables">
			<#list tables as table>
				<div class="widget flat radius-bordered">
					<div class="widget-header bg-sky theme">
						<span class="widget-caption"><span style="font-size: 24px;vertical-align: middle;"><i class="fa fa-table"></i></span><b>&nbsp;${(table.columns[0].tableName==tableName)?string("当前选中表","关联表")}&nbsp;&nbsp;${table.columns[0].tableName}</b>&nbsp;(${table.remark})&nbsp;列设置</span>
						<div class="widget-buttons">
                        <a href="#" data-toggle="collapse"></a>
                        <a href="#" data-toggle="collapse"><i class="fa red fa-minus" style="color: #FFF!important;"></i></a>
                    </div>
					</div>
					<div class="widget-body no-padding">
						<div class="table-scrollable" id="databaseTableColumnsView " style="border-bottom:none;">
							<!-- 数据表列信息列表 -->
							<table class="table table-bordered dataTable">
								<thead>
									<tr>
										<th title="数据库列名">列名</th>
										<th title="映射到java的驼峰名">映射名</th>
										<th title="映射到java的数据类型 ">java类型</th>
										<th title="列的数据库的类型名称">类型名称</th>
										<th title="是否可作为条件">作搜索条件</th>
										<th title="是否可以为空值">为空</th>
										<th title="新增时是否可编辑">新增可编辑</th>
										<th title="修改时是否可编辑">修改可编辑</th>
										<th title="是否是创建时间">创建时间</th>
										<th title="是否是修改时间">修改时间</th>
										<th title="创建者标识">创建者标识</th>
										<th title="版本标识">版本标识</th>
										<th title="主键">主键</th>
										<th title="正常字符的最大长度">最大字符数</th>
										<th title="获取指定列的指定列的大小。对于数值型数据,这是最大的精度。对于字符数据,这是长度的字符。datetime数据类型,这是长度的字符的字符串表示(假设的最大允许精确分数秒组件)。对于二进制数据,这是长度的字节。对于ROWID数据类型,这是长度的字节。0返回数据类型的列的大小,不适用。">precision</th>
										<th title="小数点右边的有效数字字符数">scale</th>
										<th class="fixedColumn" style="width:80px;">操作</th>
									</tr>
								</thead>
								<tbody>
									<#list table.columns as column>
										<tr id="tr_${column.id}" 
											tableName="${column.tableName}"
											referenceTableCatalog="${column.scheme}"
											referenceTableName="${column.referenceTable}"
											tempReferencetablename=""
											referenceColumn="${column.referenceColumn}"
											datasourceName="${column.datasourceName}"
											datasourceCatalog="${column.datasourceCatalog}"
											datasourceTableName="${column.datasourceTableName}"
											datasourceKeyColumn="${column.datasourceKeyColumn}"
											datasourceValueColumn="${column.datasourceValueColumn}"
											datasourceSql="${column.datasourceSql}">
											<td>
												<#if (column.isPrimaryKey???string((column.isPrimaryKey?string("是","否")),"")!"未设置")=="是">
													<i class="fa fa-key" title="主键" style="color:#FFC600;font-weight:900;"></i>
												<#elseif (column.isForeignKey???string((column.isForeignKey?string("是","否")),"")!"未设置")=="是">
													<i class="glyphicon glyphicon-random" title="外键" style="color: green;"></i>
												</#if>
												${column.columnName}
											</td>
											<td>${column.columnJavaFieldName}</td>
											<td>${column.columnJavaType}</td>
											<td>${column.columnTypeName}</td>
											<td>${(column.isSearchable???string((column.isSearchable?string("是","否")),"")!"未设置")}</td>
											<td>${(column.isNullable???string((column.isNullable?string("是","否")),"")!"未设置")}</td>
											<td>${(column.isAddCanEdit???string((column.isAddCanEdit?string("是","否")),"")!"未设置")}</td>
											<td>${(column.isUpdateCanEdit???string((column.isUpdateCanEdit?string("是","否")),"")!"未设置")}</td>
											<td>${(column.isCreateTime???string((column.isCreateTime?string("是","否")),"")!"未设置")}</td>
											<td>${(column.isModifiedTime???string((column.isModifiedTime?string("是","否")),"")!"未设置")}</td>
											<td>${(column.isNowLoginUserIdentifying???string((column.isNowLoginUserIdentifying?string("是","否")),"")!"未设置")}</td>
											<td>${(column.isVersionIdentifying???string((column.isVersionIdentifying?string("是","否")),"")!"未设置")}</td>
											<td>${(column.isPrimaryKey???string((column.isPrimaryKey?string("是","否")),"")!"未设置")}</td>
											<td>${column.columnDisplaySize}</td>
											<td>${column.precision}</td>
											<td>${column.scale}</td>
											<td align="center">
												<a class="btn btn-default btn-xs icon-only green" href="javascript:void(0);" onclick="showEditTableColumnMappingDialog('${column.id}','${column.tableName}')"><i class="fa  fa-edit"></i></a>
												<input type="hidden" name="attrsJsonStr" id="${column.columnName}" value='${column.attrsJsonStr}'>
												<a class="btn btn-default btn-xs icon-only green" href="javascript:void(0);" onclick="columnAttrSetting(this,'${column.id}','${column.tableName}')"><i class="fa fa-gears"></i></a>
											</td>
										</tr>
									</#list>
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</#list>
		</div>
	</#if>
	<!-- 属性面板 -->
	<div class="col-xs-4" id="attrPanel">
		<!-- 动态导入属性面板 -->
	</div>
</div>
<!-- 字段映射编辑弹出层 -->
<div class="modal fade editTableColumnMappingDialog" tabindex="1" role="dialog"
	aria-labelledby="dialog" aria-hidden="true"
	style="display: none;">
	<div class="modal-dialog">
		<div class="modal-content" style="width: 800px;">
			<form class="editForm" action="sysTableColumnMappingController/updateColumnMapping.do"
				method="post" responseType="JSON" role="form" id="editTableColumnMapping"
				data-bv-message="This value is not valid"
				data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
				data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
				data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">×</button>
					<h4 class="modal-title" id="dialog">映射编辑</h4>
				</div>
                <div class="form-title">Base Mapping Setting</div>
				<div class="modal-body">
					 <div class="row">
						<input type="hidden" name="id" value="" />
						<input type="hidden" name="tableName" />
						<input type="hidden" name="referenceCatalog" />
						<input type="hidden" name="referenceTableName" />
						<div class="form-group">
							<label for="columnJavaFieldName" class="col-sm-1 control-label no-padding-right">映射名称</label>
							<div class="col-sm-11">
		                        <input type=text class="form-control" name="columnJavaFieldName" id="columnJavaFieldName"
									placeholder="columnJavaFieldName"
									value=""
								  	data-bv-message="The field is not valid"
	                                   data-bv-notempty="true"
	                                   data-bv-notempty-message="The field is required and cannot be empty"
	                                   data-bv-regexp="true"
	                                   data-bv-regexp-regexp="^[a-z,_]+\w*$"
	                                   data-bv-regexp-message="The field can only consist of alphabetical, number, dot and underscore">
		                        <span class="text"></span>
							</div>
						</div>
						<div class="form-group">
							<label for="columnJavaType" class="col-sm-1 control-label no-padding-right">java类型</label>
							<div class="col-sm-11">
		                        <input type=text class="form-control" name="columnJavaType" id="columnJavaType"
									placeholder="使用完全限定名"
									value=""
								  	data-bv-message="The field is not valid"
	                                   data-bv-notempty="true"
	                                   data-bv-notempty-message="The field is required and cannot be empty"
	                                   data-bv-regexp="true"
	                                   data-bv-regexp-regexp="^([a-z,A-Z,_]+[\w,_]*)*(\.([a-z,A-Z,_]+[\w,_]*)+)*$"
	                                   data-bv-regexp-message="The field can only consist of alphabetical, number, dot and underscore">
		                        <span class="text"></span>
							</div>
						</div>
						<div class="form-group">
	                        <div class="form-title">Search And Edit Setting</div>
							<label for="columnJavaType" class="col-sm-2 control-label no-padding-right">作条件搜索</label>
							<div class="col-sm-2">
		                       	<input type="hidden" name="isSearchable" >
			                   	<label>
			                       <input class="checkbox-slider slider-icon yesno" type="checkbox" data-target-input-name="isSearchable">
			                       <span class="text"></span>
			                   	</label>
							</div>
						</div>
						<div class="form-group">
							<label for="columnJavaType" class="col-sm-2 control-label no-padding-right">创建者</label>
							<div class="col-sm-2">
		                       	<input type="hidden" name="isNowLoginUserIdentifying" >
			                   	<label>
			                       <input class="checkbox-slider slider-icon yesno" type="checkbox" data-target-input-name="isNowLoginUserIdentifying">
			                       <span class="text"></span>
			                   	</label>
							</div>
						</div>
						<div class="form-group">
							<label for="columnJavaType" class="col-sm-2 control-label no-padding-right">版本标识</label>
							<div class="col-sm-2">
		                       	<input type="hidden" name="isVersionIdentifying" >
			                   	<label>
			                       <input class="checkbox-slider slider-icon yesno" type="checkbox" data-target-input-name="isVersionIdentifying">
			                       <span class="text"></span>
			                   	</label>
							</div>
						</div>
						<div class="form-group" style="clear: left;">
							<label for="columnJavaType" class="col-sm-2 control-label no-padding-right">新增可编辑</label>
							<div class="col-sm-2">
		                       	<input type="hidden" name="isAddCanEdit" >
			                   	<label>
			                       <input class="checkbox-slider slider-icon yesno" type="checkbox" data-target-input-name="isAddCanEdit">
			                       <span class="text"></span>
			                   	</label>
							</div>
						</div>
						<div class="form-group">
							<label for="columnJavaType" class="col-sm-2 control-label no-padding-right">修改可编辑</label>
							<div class="col-sm-2">
		                       	<input type="hidden" name="isUpdateCanEdit" >
			                   	<label>
			                       <input class="checkbox-slider slider-icon yesno" type="checkbox" data-target-input-name="isUpdateCanEdit">
			                       <span class="text"></span>
			                   	</label>
							</div>
						</div>
						<div class="form-group">
							<label for="columnJavaType" class="col-sm-2 control-label no-padding-right">为空</label>
							<div class="col-sm-2">
		                       	<input type="hidden" name="isNullable" >
			                   	<label>
			                       <input class="checkbox-slider slider-icon yesno" type="checkbox" data-target-input-name="isNullable">
			                       <span class="text"></span>
			                   	</label>
							</div>
						</div>
						<div class="form-group" style="clear: left;">
							<label for="columnJavaType" class="col-sm-2 control-label no-padding-right">创建时间</label>
							<div class="col-sm-2">
		                       	<input type="hidden" name="isCreateTime" >
			                   	<label>
			                       <input class="checkbox-slider slider-icon yesno" type="checkbox" data-target-input-name="isCreateTime">
			                       <span class="text"></span>
			                   	</label>
							</div>
						</div>
						<div class="form-group">
							<label for="columnJavaType" class="col-sm-2 control-label no-padding-right">修改时间</label>
							<div class="col-sm-2">
		                       	<input type="hidden" name="isModifiedTime" >
			                   	<label>
			                       <input class="checkbox-slider slider-icon yesno" type="checkbox" data-target-input-name="isModifiedTime">
			                       <span class="text"></span>
			                   	</label>
							</div>
						</div>
						 <div class="form-group">
							 <label for="uploadImg" class="col-sm-2 control-label no-padding-right">文件上传</label>
							 <div class="col-sm-2">
								 <input type="hidden" name="isUploadFile" >
								 <input type="hidden" name="uploadFileConfig" >
								 <label>
									 <input class="checkbox-slider slider-icon yesno" type="checkbox" data-target-input-name="isUploadFile">
									 <span class="text"></span>
								 </label>
								 <div id="uploadFileConfig"></div>
							 </div>
						 </div>
                        <div class="form-group">
	                        <div class="col-lg-4 col-xs-12 nopadding-right" id="leftTree" style=" margin:0px 5px 0px -10px; ">
								<div class="widget flat radius-bordered">
									<div class="widget-header bg-sky theme">
										<span class="widget-caption">数据库表/视图</span>
									</div>
									<div class="widget-body" id="databaseTablesTree" style="padding: 0px 0px 0px 10px;border:1px solid #ccc; border-left:none; border-top:none;min-height: 909px; max-height: 909px; overflow: auto;">
										<!-- 动态加载数据库属性结构面板 -->
									</div>
								</div>
							</div>
	                        <div class="form-title">Reference table shows column setting</div>
							<div class="col-lg-8 col-xs-12">
								<div class="widget flat">
						            <div class="widget-body no-padding" style="border: 1px solid #CCC;min-height: 209px;max-height: 209px;overflow:hidden;">
										<table class="table table-bordered table-condensed no-margin" style="border:none; width:512px; border-bottom:1px solid #ccc;table-layout: fixed">
							                <thead>
							                    <tr>
							                        <th style="border-left: none; width:30%;overflow:hidden;height:25px;padding:0px;font-size:12px;">
							                                                       数据库列
							                        </th>
							                        <th style="width: 200px">
							                        	备注
							                        </th>
							                        <th style="width: 30%">
							                           	显示
							                        </th>
							                        <th style="width: 30%">
							                           	作检索条件
							                        </th>
							                    </tr>
							                </thead>
						                </table>
						                <div style="max-height: 178px; overflow-y: auto;overflow-x:hidden;">
											<table class="table table-bordered table-condensed no-margin" style="border:none;width:512px;table-layout: fixed">
								                <tbody id="referenceTableColumns">
								                    <!-- 动态加载 -->
								                </tbody>
								            </table>
						                </div>
									</div>
								</div>
							</div>
	                        <div class="form-title">Datasources Setting</div>
                        	<div class="col-lg-8 col-xs-12 nopadding-left">
                        		<div class="form-group">
									<label for="columnJavaType" class="col-sm-2 control-label no-padding-right">方案</label>
									<div class="col-sm-10">
				                        <input type=text class="form-control" name="datasourceCatalog" id="nowCatalog" placeholder="方案" value="">
				                        <span class="text"></span>
									</div>
								</div>
                        		<div class="form-group">
									<label for="columnJavaType" class="col-sm-2 control-label no-padding-right">数据源表</label>
									<div class="col-sm-7" id="selectedTable">
				                        <input type=text class="form-control" name="datasourceTableName" id="nowTableName" placeholder="数据源表" value="" >
				                        <span class="text"></span>
									</div>
									<div class="col-sm-3">
										<button type="button" class="btn btn-darkorange active" id="setReferenceTable">设置为引用表</button>
									</div>
								</div>
								<div id="datasourcesSetting">
	                        		<div class="form-group">
										<label for="columnJavaType" class="col-sm-2 control-label no-padding-right">数据源名称</label>
										<div class="col-sm-10">
					                        <input type=text class="form-control" name="datasourceName" id="datasourceName" placeholder="数据源名称" value="" >
					                        <span class="text"></span>
										</div>
									</div>
	                        		<div class="form-group">
										<label for="columnJavaType" class="col-sm-2 control-label no-padding-right">Key列</label>
										<div class="col-sm-10">
					                        <select  name="datasourceKeyColumn" class="form-control selectpicker" id="keyColumn">
												<optgroup label="选择key,这里选择的数据库列,将用于实际的数据关联" data-icon="icon-ok"></optgroup>
											</select>
										</div>
									</div>
	                        		<div class="form-group">
										<label for="columnJavaType" class="col-sm-2 control-label no-padding-right">Value列</label>
										<div class="col-sm-10">
					                        <select  name="datasourceValueColumn" class="form-control selectpicker" id="valueColumn" >
												<optgroup label="选择value,这里选择的数据库列,将用于用户编辑数据时展示" data-icon="icon-ok"></optgroup>
											</select>
										</div>
									</div>
	                        		<div class="form-group">
										<label for="datasourceSql" class="col-sm-2 control-label no-padding-right">SQL预览</label>
										<div class="col-sm-10">
					                        <textarea style="width: 100%;height: 100px; resize:none;" name="datasourceSql" id="dataSourceSql"></textarea>
										</div>
									</div>
									<div class="form-group">
										<div class="col-sm-12">
											 <div class="widget flat">
									            <div class="widget-header bg-sky theme">
									                <span class="widget-caption">数据源</span>
									            </div>
									            <div class="widget-body no-padding" style="border: 1px solid #CCC;min-height: 209px;max-height: 209px;overflow:hidden;">
													<table class="table table-bordered table-condensed no-margin" style="border:none; width:500px; border-bottom:1px solid #ccc">
										                <thead>
										                    <tr>
										                        <th style="width: 100px;border-left: none;">
										                            Key
										                        </th>
										                        <th >
										                            Value
										                        </th>
										                    </tr>
										                </thead>
									                </table>
									                <div style="max-height: 178px; overflow-y: auto;overflow-x:hidden;">
														<table class="table table-bordered table-condensed no-margin" style="border:none;">
											                <tbody id="datasourcesData">
											                    <!-- 动态加载 -->
											                </tbody>
											            </table>
									                </div>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<div class="form-group">
						<div class="col-sm-offset-5 col-sm-7">
							<input type="button" class="btn btn-default" data-dismiss="modal" value="取消"/>
							<button type="submit" class="btn btn-blue modalSubmitBtn">保存</button>
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
<script src="assets/js/validation/bootstrapValidator_init.js"></script>
<script>
	var defaultSettingConfig={};
	var defaultConfigHtml="";
	<#list defaultConfigs?keys as key>
	var ${key}_defaultConfig=function(){
		return eval('(${defaultConfigs[key]})');
	}
	var ${key}_temp_form="<form style='margin-bottom:0px;' name='${key}_ToJsonViewter' action='switchView.do?viewPath=sysPage/platform/codeGenerate/jsonViewter&treeViewRootNodeText=${key}' method='post' target='${key}_jsonViewter'><input type='hidden' name='initJsonStr' value='"+JSON.stringify(formatJson(${key}_defaultConfig()))+"'></form>";
	$("#config").parent().append(${key}_temp_form);
	defaultConfigHtml+="<div class='row' >"+
	    "<div class='col-lg-12 col-sm-12 col-xs-12'>"+
	        "<div class='widget radius-bordered'>"+
	            "<div class='widget-header'>"+
	                "<span class='widget-caption'><i class='fa fa-table'></i> ${key}</span>"+
	                "<div class='widget-buttons' style='padding-top: 14px;'>"+
	                    "<a href='#' data-toggle='maximize'>"+
	                        "<i class='fa fa-expand warning'></i>"+
	                    "</a>"+
	                    "<a href='#' data-toggle='collapse'>"+
	                        "<i class='fa fa-minus blue'></i>"+
	                    "</a>"+
	                "</div>"+
	            "</div>"+
	            "<div class='widget-body' style='padding:5px;'>"+
	            	"<iframe src='' width='100%' height='100%' style='margin: 0px; padding:0px; border:none;' name='${key}_jsonViewter'></iframe>"+
	            "</div>"+
	        "</div>"+
	    "</div>"+
	"</div>";
	$("[name='${key}_attrJsonConfig']").val(formatJson(${key}_defaultConfig()));
	<#if key==tableName>
	defaultSettingConfig=${key}_defaultConfig();
	</#if>
	</#list>
	$("#config").html(defaultConfigHtml).parent().find("form").submit();
	var nowEditTr=null;
	var dialog=$(".editTableColumnMappingDialog");
	var modal_body=dialog.find(".modal-body");
	//编辑映射名和映射类型表单回调
	$("#editTableColumnMapping").on("ajaxSubmitCallback",function(event,data){
		if(data.resCode==200){
			if(nowEditTr!=null){
				nowEditTr.find("td:eq(1)").text(modal_body.find("[name='columnJavaFieldName']").val());
				nowEditTr.find("td:eq(2)").text(modal_body.find("[name='columnJavaType']").val());
				
				nowEditTr.find("td:eq(4)").text(modal_body.find("[name='isSearchable']").val()=="true"?"是":"否");
				nowEditTr.find("td:eq(5)").text(modal_body.find("[name='isNullable']").val()=="true"?"是":"否");
				nowEditTr.find("td:eq(6)").text(modal_body.find("[name='isAddCanEdit']").val()=="true"?"是":"否");
				nowEditTr.find("td:eq(7)").text(modal_body.find("[name='isUpdateCanEdit']").val()=="true"?"是":"否");
				nowEditTr.find("td:eq(8)").text(modal_body.find("[name='isCreateTime']").val()=="true"?"是":"否");
				nowEditTr.find("td:eq(9)").text(modal_body.find("[name='isModifiedTime']").val()=="true"?"是":"否");
				nowEditTr.find("td:eq(10)").text(modal_body.find("[name='isNowLoginUserIdentifying']").val()=="true"?"是":"否");
				nowEditTr.find("td:eq(11)").text(modal_body.find("[name='isVersionIdentifying']").val()=="true"?"是":"否");
				
				nowEditTr.attr("datasourceCatalog",$("[name='datasourceCatalog']").val());
				nowEditTr.attr("datasourceTableName",$("[name='datasourceTableName']").val());
				nowEditTr.attr("datasourceKeyColumn",$("[name='datasourceKeyColumn']").val());
				nowEditTr.attr("datasourceValueColumn",$("[name='datasourceValueColumn']").val());
				nowEditTr.attr("datasourceSql",$("[name='datasourceSql']").val());
			}
			resetValidatorForm(this);
			dialog.modal("hide");
		}else{
			ajaxError(data.resMsg);
		}
	});
	//提交生成申请
	$("#genCode").on("ajaxSubmitCallback",function(event,data){
		if(data.resCode==200){
			alert(data.resMsg);
		}else{
			alert("生成失败!");
		}
	});
	//属性面板属性值修改
	var oldValue="";
	$(document).on("focus",".attrValue",function(){
		$(".attrValue").attr("disabled",true);
		oldValue=$(this).val();
		$(".attrValue").attr("disabled",false);
		return false;
	});
	$(document).on("blur",".attrValue",function(){
		setConfig(this);
		return false;
	});
	$(document).on("change",".attrValue_select",function(){
		setConfig(this);
		return false;
	});
	
	//自动生成数据源SQL
	$(document).on("change",".selectpicker",function(){
		var nowCatalog=$("#nowCatalog").val();
		var nowTableName=$("#nowTableName").val();
		var keyColumn=$("#keyColumn").val();
		var valueColumn=$("#valueColumn").val();
		var datasourceName=$("#datasourceName");
		var dataSourceSql=$("#dataSourceSql");
		if(nowCatalog && nowTableName && keyColumn && valueColumn){
			nowCatalog = nowCatalog.toString().toLowerCase();
			nowTableName = nowTableName.toString().toLowerCase();
			keyColumn = keyColumn.toString().toLowerCase();
			valueColumn= valueColumn.toString().toLowerCase();
			var remark=$(this).find("option:checked").attr("remark");
			var sql="SELECT "+keyColumn+","+valueColumn+" FROM "+nowCatalog+"."+nowTableName;
			var sql1="SELECT "+keyColumn+" keyColumn,"+valueColumn+" valueColumn FROM "+nowCatalog+"."+nowTableName;
			dataSourceSql.val(sql);
			datasourceName.val(remark);
			ajaxRequest("codeGenerateController/getDataSourcesData.do?timer="+new Date().getTime(), {sql:sql1}, function(result) {
				var list=result.data;
				var length=list.length;
				$("#datasourcesData").html("");
				for(var i=0;i<length;i++){
					var key=list[i].keyColumn;
					var value=list[i].valueColumn;
					var tr="<tr>"+
			                	"<td style=\"min-width: 100px;width: 100px;max-width: 100px;border-left: none;overflow:hidden;"+(i==0?"border-top:none;":"")+"\">"+key+ "</td>"+
			                    "<td style=\"min-width: 400px;width: 400px;max-width: 400px;overflow:hidden;"+(i==0?"border-top:none;":"")+"\">"+value+"</td>"+
			                "</tr>";
					$("#datasourcesData").append(tr);
				}
			},function(XMLHttpRequest, textStatus, errorThrown) {
				ajaxError(errorThrown);
			}, "GET", "JSON");
		}else{
			dataSourceSql.val("");
		}
		return false;
	});
	//打开节点
	$(document).on("opened","#databaseTableTree", function(evt, data) {
		console.log("sub-folder opened: ", data.params);
		var nowCatalog = "";
		if (data.params && data.params.catalog) {
			nowCatalog = data.params.catalog;
		}
		$("#nowCatalog").val(nowCatalog);
		$("#nowTableName").val("");
	});
	//选中节点
	$(document).on("selected","#databaseTableTree", function(evt, data) {
		console.log("item selected: ", data.info[0]);
		var selectedItems = $(this).tree('selectedItems')
		console.log(selectedItems);
		var nowTableName = "";
		if (data.info && data.info[0].name) {
			nowTableName = data.info[0].name;
		}
		$("#nowTableName").val(nowTableName);
		loadDialogDatabaseTableColumn();
	});
	//手动设置为引用表
	$("#setReferenceTable").click(function(){
		var nowCatalog=$("#nowCatalog").val();
		var nowTableName=$("#nowTableName").val();
		var columnId=nowEditTr.attr("id");
		if(!nowCatalog || !nowTableName){
			alert("请先选择表!");
			return false;
		}
		var params={
				catalog : nowCatalog,
				tableName:nowTableName,
				columnId:columnId.split("_")[1]
			}
		ajaxRequest("sysTableColumnMappingController/updateColumnMapping.do?timer="+new Date().getTime(), params, function(result) {
			if(result.resCode=="200"){
				nowEditTr.attr("referencetablename",nowTableName);
				nowEditTr.attr("tempReferencetablename",nowTableName);
				loadReferenceTableColumn(params,nowTableName);
			}else{
				alert(result.resMsg);
			}
		},function(XMLHttpRequest, textStatus, errorThrown) {
			ajaxError(errorThrown);
		}, "GET", "JSON");
	});

	//加载属性面板
	$("#attrPanel").load("sysFormAttrDictionaryController/attrPanel.do");
	
	//显示编辑映射名和映射类型的弹出层
	function showEditTableColumnMappingDialog(id,tableName){
		nowEditTr=$("#tr_"+id);
		var columnJavaFieldName=nowEditTr.find("td:eq(1)").text();
		var columnJavaType=nowEditTr.find("td:eq(2)").text();
		
		var isSearchable=nowEditTr.find("td:eq(4)").text();
		var isNullable=nowEditTr.find("td:eq(5)").text();
		var isAddCanEdit=nowEditTr.find("td:eq(6)").text();
		var isUpdateCanEdit=nowEditTr.find("td:eq(7)").text();
		var isCreateTime=nowEditTr.find("td:eq(8)").text();
		var isModifiedTime=nowEditTr.find("td:eq(9)").text();
		var isNowLoginUserIdentifying=nowEditTr.find("td:eq(10)").text();
		var isVersionIdentifying=nowEditTr.find("td:eq(11)").text();
		
		modal_body.find("[name='tableName']").val(tableName);
		
		modal_body.find("[name='id']").val(id);
		modal_body.find("[name='columnJavaFieldName']").val(columnJavaFieldName);
		modal_body.find("[name='columnJavaType']").val(columnJavaType);
		
		modal_body.find("[data-target-input-name='isSearchable']").attr("checked",isSearchable=="是");
		modal_body.find("[data-target-input-name='isNowLoginUserIdentifying']").attr("checked",isNowLoginUserIdentifying=="是");
		modal_body.find("[data-target-input-name='isVersionIdentifying']").attr("checked",isVersionIdentifying=="是");
		modal_body.find("[data-target-input-name='isNullable']").attr("checked",isNullable=="是");
		modal_body.find("[data-target-input-name='isAddCanEdit']").attr("checked",isAddCanEdit=="是");
		modal_body.find("[data-target-input-name='isUpdateCanEdit']").attr("checked",isUpdateCanEdit=="是");
		modal_body.find("[data-target-input-name='isCreateTime']").attr("checked",isCreateTime=="是");
		modal_body.find("[data-target-input-name='isModifiedTime']").attr("checked",isModifiedTime=="是");
		
		modal_body.find("[name='isSearchable']").attr("value",isSearchable=="是");
		modal_body.find("[name='isNowLoginUserIdentifying']").attr("value",isNowLoginUserIdentifying=="是");
		modal_body.find("[name='isVersionIdentifying']").attr("value",isVersionIdentifying=="是");
		modal_body.find("[name='isNullable']").attr("value",isNullable=="是");
		modal_body.find("[name='isAddCanEdit']").attr("value",isAddCanEdit=="是");
		modal_body.find("[name='isUpdateCanEdit']").attr("value",isUpdateCanEdit=="是");
		modal_body.find("[name='isCreateTime']").attr("value",isCreateTime=="是");
		modal_body.find("[name='isModifiedTime']").attr("value",isModifiedTime=="是");
		
		$("#datasourcesData").html("");
		modal_body.find("[name='datasourceName']").val(nowEditTr.attr("datasourceName"));
		modal_body.find("[name='datasourceCatalog']").val(nowEditTr.attr("datasourceCatalog"));
		modal_body.find("[name='datasourceTableName']").val(nowEditTr.attr("datasourceTableName"));
		loadDialogDatabaseTableColumn(function(){
			modal_body.find("[name='datasourceKeyColumn']").val(nowEditTr.attr("datasourceKeyColumn"));
			modal_body.find("[name='datasourceValueColumn']").val(nowEditTr.attr("datasourceValueColumn")).change();
		});
		
		dialog.modal({
			backdrop:"static",
			show:true
		});
		dialog.on("hide.bs.modal",function(e){
			resetValidatorForm($("#editTableColumnMapping").get(0));
		});
		var nowTableName=nowEditTr.attr("tableName");
		var nowColumnName=nowEditTr.attr("referenceColumn");
		var catalog=nowEditTr.attr("referenceTableCatalog");
		var tableName=nowEditTr.attr("referenceTableName");
		if(catalog){
			$("[name='referenceCatalog']").val(catalog);
		}else{
			$("[name='referenceCatalog']").val("");
		}
		if(tableName){
			$("[name='referenceTableName']").val(tableName);
		}else{
			$("[name='referenceTableName']").val("");
		}
		var params={
			catalog:catalog,
			tableName:tableName
		}
		loadReferenceTableColumn(params,nowTableName);
		//加载数据库表
		$("#databaseTablesTree").load("switchView.do?viewPath=sysPage/platform/codeGenerate/databaseTablesTree.html",function(){
			loadAjaxTree("databaseTableTree");
		});
	}
	
	function loadReferenceTableColumn(params,nowTableName){
		//加载引用表列
		function test(result,column,columnName){
			var list=result.data;
			var length=list.length;
			for(var i=0;i<length;i++){
				var columnName1=list[i][column];
				if(columnName1){
					var columnNames=columnName1.split(",");
					var bol=$.inArray(columnName,columnNames);
					if(bol>-1){
						return true;
					}
				}
			}
			return false;
		}
		var tableName=params.tableName;
		$("#referenceTableColumns").html("");
		ajaxRequest("codeGenerateController/tableColumnsJsonStr.do?timer="+new Date().getTime(), params, function(result) {
			var list=result.data;
			var length=list.length;
			var setReferenceTable=$("#setReferenceTable");
			var datasourcesSetting=$("#datasourcesSetting");
			if(length==0){
				$("#selectedTable").removeClass("col-sm-10").addClass("col-sm-7");
				setReferenceTable.show();
				datasourcesSetting.hide();
			}else{
				var referencetablename=nowEditTr.attr("tempReferencetablename");
				var isVisible=setReferenceTable.is(":visible");
				if(isVisible){
					$("#selectedTable").removeClass("col-sm-7").addClass("col-sm-10");
					setReferenceTable.hide();
					datasourcesSetting.show();
				}
				if(referencetablename){
					$("#selectedTable").removeClass("col-sm-10").addClass("col-sm-7");
					setReferenceTable.show();
				}
				ajaxRequest("sysTableColumnMappingController/getTableMappingJsonStr.do?timer="+new Date().getTime(), {catalog:params.catalog,tableName:nowTableName}, function(result1) {
					for(var i=0;i<length;i++){
						var columnName=list[i].columnName;
						var columnJavaFieldName=list[i].remarks;
						var checkedValue=test(result1,"referenceTableShowColumns",columnName);
						var checked=test(result1,"referenceTableShowColumns",columnName)?"checked":"";
						
						var checkedValue1=test(result1,"referenceTableSearchColumns",columnName);
						var checked1=test(result1,"referenceTableSearchColumns",columnName)?"checked":"";
						var tr="<tr>"+
				                	"<td style=\"width:30%;height:25px;padding:0px;font-size:12px;border-left: none;overflow:hidden;"+(i==0?"border-top:none;":"")+"\">"+columnName+ "</td>"+
				                    "<td style=\"width:200px;height:25px;padding:0px;font-size:12px;overflow:hidden;"+(i==0?"border-top:none;":"")+"\">"+columnJavaFieldName+"</td>"+
				                    "<td style=\"width:30%;height:25px;padding:0px;font-size:12px;overflow:hidden;"+(i==0?"border-top:none;":"")+"\">"+
				                    	"<input type=\"hidden\" name=\""+tableName+"_show_"+columnName+"\" value=\""+checkedValue+"\">"+
					                   	"<label style=\"cursor: pointer;height: 25px;\">"+
					                       "<input class=\"checkbox-slider slider-icon yesno\" type=\"checkbox\" "+checked+" data-target-input-name=\""+tableName+"_show_"+columnName+"\">"+
					                       "<span class=\"text\"></span>"+
					                   	"</label>"+
				                    "</td>"+
				                    "<td style=\"width:30%;height:25px;padding:0px;font-size:12px;overflow:hidden;"+(i==0?"border-top:none;":"")+"\">"+
				                    	"<input type=\"hidden\" name=\""+tableName+"_search_"+columnName+"\" value=\""+checkedValue1+"\">"+
					                   	"<label style=\"cursor: pointer;height: 25px;\">"+
					                       "<input class=\"checkbox-slider slider-icon yesno\" type=\"checkbox\" "+checked1+" data-target-input-name=\""+tableName+"_search_"+columnName+"\">"+
					                       "<span class=\"text\"></span>"+
					                   	"</label>"+
				                    "</td>"+
				                "</tr>";
						$("#referenceTableColumns").append(tr);
					}
				},function(XMLHttpRequest, textStatus, errorThrown) {
					ajaxError(errorThrown);
				}, "GET", "JSON");
			}
		},function(XMLHttpRequest, textStatus, errorThrown) {
			ajaxError(errorThrown);
		}, "GET", "JSON");
	}
	
	function loadDialogDatabaseTableColumn(callback){
		var nowCatalog=$("#nowCatalog").val();
		var nowTableName=$("#nowTableName").val();
		if(nowTableName){
			var url = "codeGenerateController/tableColumnsJsonStr.do?timer="+new Date().getTime();
			var params = {
				catalog : nowCatalog,
				tableName : nowTableName
			};
			ajaxRequest(url, params, function(result) {
				var list=result.data;
				var length=list.length;
				$(".selectpicker optgroup").html("");
				for(var i=0;i<length;i++){
					var columnName=list[i].columnName;
					var remarks=list[i].remarks;
					$(".selectpicker optgroup").append("<option value='"+columnName+"' remark='"+remarks+"'>"+remarks+(remarks?"=>":"")+columnName+" </option>");
				}
				$(".selectpicker").val("")
				if(typeof callback === "function"){
					callback();
				}
			},function(XMLHttpRequest, textStatus, errorThrown) {
				ajaxError(errorThrown);
			}, "GET", "JSON");
		}
	}
	
	var nowSetingTableName;
	//点击每一行属性设置按钮,初始化当前行的默认属性
	function columnAttrSetting(_this,id,setTableName){
		nowSetingTableName=setTableName;
		defaultSettingConfig=eval("("+nowSetingTableName+"_defaultConfig())");
		var that=$(_this);
		var tr=$("#tr_"+id);
		var attrsJson=eval("("+that.prev("[name='attrsJsonStr']").val()+")");
		var columnJavaFieldName=tr.find("td:eq(1)").text();
		var attrPanel=$("#attrPanel");
		var widgetCaption=attrPanel.find(".widget-caption");
		var attrs=$(".attrPanel tbody td:nth-child(2n+1)");
		widgetCaption.find("span").remove().end().append("<span>【<span id='nowSetColumn'>"+columnJavaFieldName+"</span>】<span>");
		tr.siblings().css("background-color","#FFF");
		tr.css("background-color","#FFF2D3");
		//设置当前选中字段属性值
		attrs.each(function(index,item){
			var attrName=$.trim($(item).text());
			attrName=attrName=="class"?"_class":attrName;
			attrName=attrName=="data-*"?"data_x":attrName;
			$(item).next().find(".attrValue").val(attrsJson[attrName]);
		});
	}

	//设置参数
	function setConfig(_this){
		$(".attrValue").attr("disabled",true);
		var newValue=$(_this).val();
		var targetAttr=$(_this).attr("targetAttr");
		var nowSetColumn=$("#nowSetColumn").text();
		if(oldValue!=newValue){
			targetAttr=targetAttr=="class"?"_class":targetAttr;
			targetAttr=targetAttr=="data-*"?"data_x":targetAttr;
			changeSetting(nowSetColumn , targetAttr , newValue);
		}
		$(".attrValue").attr("disabled",false);
	}
	
	//改变参数设置值
	function changeSetting(nowSetColumn , targetAttr , newValue){  
		//修改当前编辑字段配置
		var column=$("#"+nowSetColumn);
		var oldSetting=eval("("+column.val()+")");
		oldSetting[targetAttr]=newValue;
		column.val(JSON.stringify(oldSetting));
		//修改全局配置参数
		defaultSettingConfig[nowSetColumn][targetAttr]=newValue;
		$("[name='"+nowSetingTableName+"_ToJsonViewter']").find("[name='initJsonStr']").val(JSON.stringify(formatJson(defaultSettingConfig))).end().submit();
		$("[name='"+nowSetingTableName+"_attrJsonConfig']").val(formatJson(defaultSettingConfig));
	}

	//关联表生成文件全选/全不选
	$(".genFile_checkAll input:checkbox").change(function(){
		$(this).parents(".genFile_checkAll").siblings().find("input:checkbox").click();
		if(this.checked){
			$(this).parents(".genFile_checkAll").siblings().find("input:checkbox").each(function(index,item){
				if(!item.checked){
					$(item).click();
				}
			});
		}else{
			$(this).parents(".genFile_checkAll").siblings().find("input:checkbox").each(function(index,item){
				if(item.checked){
					$(item).click();
				}
			});
		}
	});

	//文件组件参数设置
	$("[data-target-input-name='isUploadFile']").change(function(){
		var columnJavaFieldName=$("#editTableColumnMapping #columnJavaFieldName").val();
		var uploadFileConfig=$("[name='uploadFileConfig']");
		if(!this.checked){
			uploadFileConfig.val("");
			return ;
		}
		//加载上传组件参数配置设置页面
		ajaxRequest("switchView.do?viewPath=sysPage/platform/codeGenerate/uploadFileSetting.html", {columnJavaFieldName:columnJavaFieldName},	function(html) {
			bootbox.dialog({
				message : html,
				size:"large",
				title : "文件上传参数配置",
				className : "uploadeSetting",
				backdrop:false,//不显示遮罩层,避免手动关闭层之后遮罩层残留
				buttons : {
					success : {
						label : "确定",
						className : "btn-blue",
						callback : function() {
							var isValid = uploadPlusConfigForm.data("bootstrapValidator").validate().isValid();//手动验证并获取验证结果
							if (isValid) {
								var params = uploadPlusConfigForm.serializeArray();//文件上传组件参数配置信息
								uploadFileConfig.val(JSON.stringify(params));
								console.log(JSON.stringify(params));
								//手动关闭上传组件配置层,防止其他层无法下拉
								$(".uploadeSetting ").slideUp(function(){
									$(".uploadeSetting ").remove();
								});
							}
							return false;
						}
					}
				},
				onEscape:function(){
					$("[data-target-input-name='isUploadFile']").get(0).checked=false;
				}
			});
		},
		function(XMLHttpRequest, textStatus, errorThrown) {
			ajaxError(errorThrown);
		},"GET", "HTML");
	});
</script>